import re

from fontTools.ttLib import TTFont

font = TTFont("./a-58字体.ttf")

cmap = font.get("cmap").getBestCmap()
# print(cmap)

ttf_dict = dict()

for k, v in cmap.items():
    # print(k, v)
    # print(hex(k), v)
    # print(hex(k), int(re.search(r"\d+", v).group(0)) - 1)
    new_dict_k = hex(k)
    new_dict_v = int(re.search(r"\d+", v).group(0))-1
    ttf_dict[new_dict_k] = new_dict_v

print("解析后：", ttf_dict)
